home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Examples / SimpleContainer / UContainerApplication.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  3.8 KB  |  131 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // UContainerApplication.cp
  3. // Copyright © 1996 by Apple Computer, Inc. All rights reserved. 
  4. //----------------------------------------------------------------------------------------
  5.  
  6.  
  7. #ifndef __UContainerApplication__
  8. #include "UContainerApplication.h"
  9. #endif
  10.  
  11. #ifndef __UContainerDocument__
  12. #include "UContainerDocument.h"
  13. #endif
  14.  
  15. #ifndef __UCONTAINER__
  16. #include "UContainer.h"
  17. #endif
  18.  
  19.  
  20. #ifndef __UMENUMGR__
  21. #include "UMenuMgr.h"
  22. #endif
  23.  
  24. #define kStandardMenuBar    128
  25. #define kODMenuBar            129
  26.  
  27. //----------------------------------------------------------------------------------------
  28. // Constants:
  29.  
  30.  
  31. const OSType kSignature            = 'SS07';            // Application signature
  32.         
  33. const CommandNumber cCommandHandledByApplication =    400;
  34.  
  35. //========================================================================================
  36. // CLASS TContainerApplication
  37. //========================================================================================
  38. #undef Inherited
  39. #define Inherited TApplication
  40.  
  41. #pragma segment AInit
  42. MA_DEFINE_CLASS_M1(TContainerApplication, Inherited);
  43.  
  44. //----------------------------------------------------------------------------------------
  45. // TContainerApplication constructor
  46. //----------------------------------------------------------------------------------------
  47. #pragma segment AOpen
  48.  
  49. TContainerApplication::TContainerApplication()
  50. {
  51.  
  52. #if qOpenDoc
  53.     if (gContainerLib)
  54.     {
  55.         fDisplayedMenus = kODMenuBar;
  56.     }
  57.     else
  58. #endif
  59.     {
  60.         fDisplayedMenus = kStandardMenuBar;
  61.     }
  62. }
  63.  
  64. //----------------------------------------------------------------------------------------
  65. // TContainerApplication destructor
  66. //----------------------------------------------------------------------------------------
  67. #pragma segment MADestructorRes
  68.  
  69. TContainerApplication::~TContainerApplication()
  70. {
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // TContainerApplication::IContainerApplication: 
  75. //----------------------------------------------------------------------------------------
  76. #pragma segment AInit
  77.  
  78. void TContainerApplication::IContainerApplication()
  79. {
  80.     this->IApplication(kFileType,kSignature);
  81. } // TContainerApplication::IContainerApplication 
  82.  
  83. //----------------------------------------------------------------------------------------
  84. // TContainerApplication::DoMakeDocument:
  85. //----------------------------------------------------------------------------------------
  86. #pragma segment AOpen
  87.             
  88. TDocument* TContainerApplication::DoMakeDocument(CommandNumber /* itsCommandNumber */,
  89.                                                         TFile* itsFile)
  90. {
  91.     TContainerDocument* aDocument = new TContainerDocument;
  92.     
  93.     aDocument->IContainerDocument(itsFile,kSignature);
  94.     return aDocument;
  95. } // TContainerApplication::DoMakeDocument 
  96.  
  97. //----------------------------------------------------------------------------------------
  98. // TContainerApplication::DoMenuCommand: 
  99. //----------------------------------------------------------------------------------------
  100. #pragma segment ASelCommand
  101.  
  102. void TContainerApplication::DoMenuCommand(CommandNumber aCommandNumber)
  103. {
  104.     switch (aCommandNumber) 
  105.     {
  106.         case cCommandHandledByApplication : 
  107.             SysBeep(2);
  108.             break;
  109.         default:
  110.             Inherited::DoMenuCommand(aCommandNumber);
  111.             break;
  112.     }
  113. } // TContainerApplication::DoMenuCommand 
  114.  
  115. //----------------------------------------------------------------------------------------
  116. // TContainerApplication::DoSetupMenus:
  117. //----------------------------------------------------------------------------------------
  118. #pragma segment ARes
  119.  
  120. void TContainerApplication::DoSetupMenus() 
  121. {
  122.     Inherited::DoSetupMenus();                
  123.  
  124.     Enable(cCommandHandledByApplication,TRUE);
  125. } // TContainerApplication::DoSetupMenus 
  126.  
  127. //----------------------------------------------------------------------------------------
  128. // End of UContainerApplication.cp
  129.  
  130. #pragma segment Inline
  131.